/*
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution code; The documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Jess Nielsen (jessn@bluebottle.com).
 *
 * Copyright remains Jess Nielsen's, and as such any Copyright notices in
 * the code are not to be removed.If this package is used in a product,
 * Jess Nielsen should be given attribution as the author of the parts of
 * the library used. This can be in the form of a textual message at program
 * startup or in documentation (online or textual) provided with the package.
 *
 * THIS SOFTWARE IS PROVIDED BY JESS NIELSEN ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifdef ADOADAPTER_EXPORTS
#define ADOADAPTER_API __declspec(dllexport)
#else
#define ADOADAPTER_API __declspec(dllimport)
#endif

#pragma warning(disable:4251)

#import "msado15.dll" rename_namespace("") rename("EOF", "ADO_EOF") rename("BOF", "ADO_BOF")

#include "Database.h"
#include <list>

class ADOADAPTER_API CADOConnection : public CResource
{
public:
  CADOConnection(const char * pszConnStr);
  ~CADOConnection();
	_variant_t getConnectionVariant(_ConnectionPtr con);

  virtual void CADOConnection::setInUse(bool bInUse);
	virtual _variant_t getConnectionVariant();
  virtual void * getConnection();
private:
  _ConnectionPtr m_connection;
};

class ADOADAPTER_API CADOPool : public CPool
{
public:
  CADOPool();
  ~CADOPool();
  virtual CResource* aquire();
  virtual void release(CResource* res);
protected:
  CResource * findNewConnection();
private:
  std::list<CResource*> m_pool;
  HANDLE m_hMutex;
};

class ADOADAPTER_API CADOPoolFactory : public CPoolFactory
{
public:
  CPool* getPool();
};